<template>
  <base-page :show-tabbar="true" :page-params="pageParams" @testAgainFn="testAgainFn">
    <view class="baseview">
      <!-- 用户信息 -->
      <view class="userview">
        <image v-if="vuex_imgPath" class="userview-bg" :src="vuex_imgPath + '/xfs-user-bg.png'" />
        <!--     #ifdef MP-WEIXIN-->
        <view
          v-if="(vuex_loginStatus && vuex_memberInfo && (vuex_memberInfo.accountType == 20 || vuex_memberInfo.accountType == 30)) && isBindWechat==0"
          class="growth-weixin"
          @click="accountBindWechatFn"
        >
          <view class="growth-weixin-title">
            <view class="growth-wechat-icon font_family">&#xe64f;</view>
            绑定微信成长值
          </view>
          <view class="growth-weixin-val">
            <view>+100</view>
            <view class="growth-right-icon font_family">&#xe60d;</view>
          </view>
        </view>
        <!--    #endif-->
      </view>
      <view
        class="content-box"
        :style="'top:'+(vuex_systemInfo[1].safeAreaInsets.top+44)+'px'"
      >
        <view class="user-info">
          <view class="usericon">
            <img
              v-if="vuex_loginStatus && (vuex_memberInfo.headPicPath || vuex_userInfo.avatar || vuex_userInfo.avatarUrl)"
              :src="vuex_memberInfo.headPicPath || vuex_userInfo.avatar || vuex_userInfo.avatarUrl"
              alt=""
              @click.stop="$u.throttle(avatarClickFn, 500)"
            >
            <img
              v-else-if="vuex_imgPath"
              :src="vuex_imgPath+'/avatar_icon.png'"
              alt=""
              @click.stop="$u.throttle(onLoginButtonClick, 500)"
            >
          </view>
          <view class="userinfo-wrap">
            <view class="userinfoview">
              <view v-if="vuex_loginStatus" class="logininfo flex-info-wrap">
                <view v-if="vuex_memberInfo.accountType == 20" class="user-name">{{ vuex_memberInfo.userName || vuex_accountInfo.mobilePhone }}</view>
                <view v-if="vuex_memberInfo.accountType == 30" class="user-name">{{ vuex_crmCustomerInfos[0].customerName }}</view>
                <!-- 认证客户需要展示公司名称 -->
                <!-- <view v-if="vuex_memberInfo.accountType == 30" class="company-name">({{ vuex_memberCompanyInfo.companyName }})</view> -->
                <!--              <view class="tel">手机号：{{ vuex_accountInfo.mobilePhone }}</view>-->
              </view>
              <view v-else class="logininfo">
                <view @click.stop="$u.throttle(onLoginButtonClick, 500)">登录/注册</view>
                <!-- <view class="tel">您现在是游客身份哦~</view> -->
              </view>
            </view>
            <view class="vip-wrap">
              <view v-if="vuex_loginStatus" class="vip-info-img">
                <image
                  style="width: 142rpx;height: 48rpx"
                  :src="vuex_memberLevelResp.appLevelIconUrl"
                />
              </view>
              <view v-else class="nologin-tips">您现在是游客身份哦~</view>
              <view class="operate-box">
                <view class="service-icon font_family" @click="serviceFn">&#xe621;</view>
                <view class="message-icon font_family" @click="messageFn">&#xe614;</view>
                <view class="box">
                  <u-badge
                    number-type="overflow"
                    :type="messageType"
                    :show-zero="false"
                    max="99"
                    :value="messageCount"
                    class="point-red"
                  />
                </view>
                <view class="setting-icon font_family" @click="setFn">&#xe647;</view>
              </view>
            </view>
          </view>
        </view>
        <view class="menu-cell-box">
          <view
            v-if="!vuex_loginStatus || (vuex_loginStatus && vuex_memberInfo && (vuex_memberInfo.accountType == 20 || vuex_memberInfo.accountType == 30))"
            class="el-combination"
          >
            <ul>
              <li>
                <view
                  class="li-item"
                  @click="toGrowthFn"
                >
                  <view class="item-val">{{ vuex_loginStatus ? (vuex_allMemberInfos.memberLevelResp.growth || 0) : 0 }}</view>
                  <view class="item-title">
                    <text>成长值</text>
                    <text class="normal-right-icon font_family">&#xe60d;</text>
                  </view>
                </view>
                <view class="dash-line" />
              </li>
              <li>
                <view
                  class="li-item"
                  @click="goPointsMallFn"
                >
                  <view class="item-val">{{ vuex_loginStatus ? (vuex_allMemberInfos.integralManageInfo && vuex_allMemberInfos.integralManageInfo.waitIntegral || 0) : 0 }}</view>
                  <view class="item-title">
                    <text>积分</text>
                    <text class="normal-right-icon font_family">&#xe60d;</text>
                  </view>
                </view>
                <view class="dash-line" />
              </li>
              <li>
                <view
                  class="li-item"
                  @click="toCouponFn"
                >
                  <view class="item-val">{{ countCouponNum }}</view>
                  <view class="item-title">
                    <text>优惠券</text>
                    <text class="normal-right-icon font_family">&#xe60d;</text>
                  </view>
                </view>
              </li>
            </ul>
          </view>
          <view class="menu-cell">
            <MenuCell
              :cell-data.sync="menuList"
              :cell-column="vuex_loginStatus ? ((vuex_memberInfo.accountType == 20 || vuex_memberInfo.accountType == 30) ? ycCellColumn : cellColumn) : noLoginCellColumn"
              @handelCellMethod="handelCellMethod"
            />
          </view>
        </view>
      </view>
    </view>
    <u-popup :show="show" mode="center" :round="16">
      <view class="dialog">
        <view class="top_icons">
          <view class="icons">
            <u-icon name="close-circle" color="#333333" size="24" @click="show = false" />
          </view>
        </view>
        <image :src="vuex_imgPath+'/adviser.png'" class="title-img" />
        <view v-if="bindData.length > 0" class="tips">点击识别二维码，添加专属顾问企业微信</view>
        <view v-if="bindData.length > 0" class="bodyCon">
          <view v-for="(item,index) in bindData" :key="index" class="content">
            <img v-if="!!item.qrCode" :src="item.qrCode" @click="codeView(index)">
            <image v-else mode="widthFix" :src="vuex_imgPath+'/logoNew.png'" class="qrcodeImgs" />
            <view class="Conten_small">
              <p v-if="!!item.customerName" class="name">{{ item.customerName }}</p>
              <p class="name">姓名：{{ item.saleName }}</p>
              <p class="tel">联系电话：{{ item.saleMobile }}</p>
            </view>
          </view>
        </view>
        <view v-else class="NoData">
          <view class="topImg">
            <img v-if="vuex_imgPath" :src="vuex_imgPath+'/noshop.png'">
            您还没有专属销售~
          </view>
          <view class="Qustion">如有问题请咨询客服热线：<text>400-650-2828</text></view>
        </view>
      </view>
    </u-popup>
    <!-- 登录弹框 -->
    <u-popup :show="showPopVisible" :round="5" mode="bottom" height="380" @close="closePop">
      <RegisterPop @closePopFn="closePop" />
    </u-popup>
    <ConfirmModal
      :title="'提示'"
      :show="modalOptions.modalShow"
      :modal-list="modalOptions.modalList"
      :custom="modalOptions.custom"
      @confirm="modalConfirmFn"
      @cancel="modalCancelFn"
    />
  </base-page>
</template>

<script>
import basePage from '@/components/base-page'
import RegisterPop from '@/components/register-pop'
import MenuCell from '@/components/menu-cell'
import ConfirmModal from '@/components/confirm-modal'
import { loginMixin } from '@/login/loginMixin'
import { getBindUser, wxJsCode, getWechatTokenByM, getUserinfoByPc, wechatLoginV3 } from '@/api/login.js'
import {
  countCouponNumForStauts,
  noBrowseCount,
  queryAccountBindWechat,
  accountBindWechat, modifyUserNikeName,
} from '@/api/yc_userInfo'
import { getLoginInfoFn, tdkUrl } from '@/common/common'
import {
  getAuthCode,
  getUserInfo
} from '@/utils/login'
export default {
  name: 'Index',
  components: {
    RegisterPop,
    basePage,
    MenuCell,
    ConfirmModal
  },
  mixins: [loginMixin],
  data() {
    return {
      isBindWechat: 0, // 是否已绑定微信 1:已绑定，0:未绑定
      show: false,
      showPopVisible: false,
      // 客服电话
      phoneNum: '400-650-2828',
      pageParams: {
        state: null,
        emptyTitle: '',
        errorTitle: '',
        showButton: false
      },
      bindData: [],
      cellColumn: [
        {
          label: '专属顾问',
          leftImg: '/static/myAccount/exclusive48.png',
          showRightIcon: true,
          methodName: 'showDialog',
        },
        {
          label: '客服电话',
          leftImg: '/static/myAccount/service48_icon.png',
          showRightIcon: true,
          fields: ['phoneNum'],
          contentStyle: 'font-size: 24rpx;color: #808080;',
          methodName: 'makePhoneCallEvent'
        },
        {
          label: '意见反馈',
          leftImgIconfont: 'icon-yijianfankui_tongyong_1',
          showRightIcon: true,
          methodName: 'feedbackListFn'
        },
        {
          label: '设置',
          leftImg: '/static/myAccount/setting48_icon.png',
          showRightIcon: true,
          linkUrl: '/myAccount/setting/index',
        }
      ],
      ycCellColumn: [
        {
          label: '我的收藏',
          leftImg: '/static/myAccount/collection48.png',
          showRightIcon: true,
          methodName: 'goCollectionFn',
        },
        {
          label: '常购商品',
          leftImg: '/static/myAccount/frequentlyPurchasedGoods_icon.png',
          showRightIcon: true,
          methodName: 'goFrequentlyPurchasedGoodsFn',
        },
        {
          label: '会员权益',
          leftImg: '/static/myAccount/member_icon.png',
          showRightIcon: true,
          methodName: 'goMemberFn',
        },
        {
          label: '礼品商城',
          leftImg: '/static/myAccount/pointsMall_icon.png',
          showRightIcon: true,
          methodName: 'goPointsMallFn',
        },
        {
          label: '兑换中心',
          leftImg: '/static/myAccount/setting48_icon.png',
          showRightIcon: true,
          methodName: 'goLogisFn',
        },
        /*{
          label: '我的优惠券',
          leftImg: '/static/myAccount/coupon48.png',
          showRightIcon: true,
          linkUrl: '/myAccount/coupon/index',
        },*/
        {
          label: '专属顾问',
          leftImg: '/static/myAccount/exclusive48.png',
          showRightIcon: true,
          methodName: 'showDialog',
        },
        {
          label: '客服电话',
          leftImg: '/static/myAccount/service48_icon.png',
          showRightIcon: true,
          fields: ['phoneNum'],
          contentStyle: 'font-size: 24rpx;color: #808080;',
          methodName: 'makePhoneCallEvent'
        },
        // #ifdef MP-WEIXIN
        {
          label: '满意度调研',
          leftImg: '/static/myAccount/setting48_icon.png',
          showRightIcon: true,
          linkUrl: '/myAccount/questionSurvey/index',
        },
        // #endif
        {
          label: '意见反馈',
          leftImgIconfont: 'icon-yijianfankui_tongyong_1',
          showRightIcon: true,
          methodName: 'feedbackListFn'
        },
        {
          label: '设置',
          leftImg: '/static/myAccount/setting48_icon.png',
          showRightIcon: true,
          linkUrl: '/myAccount/setting/index',
        }

      ],
      noLoginCellColumn: [
        {
          label: '我的收藏',
          leftImg: '/static/myAccount/collection48.png',
          showRightIcon: true,
          methodName: 'goCollectionFn',
        },
        {
          label: '常购商品',
          leftImg: '/static/myAccount/frequentlyPurchasedGoods_icon.png',
          showRightIcon: true,
          methodName: 'goFrequentlyPurchasedGoodsFn',
        },
        {
          label: '会员权益',
          leftImg: '/static/myAccount/member_icon.png',
          showRightIcon: true,
          methodName: 'goMemberFn',
        },
        {
          label: '礼品商城',
          leftImg: '/static/myAccount/pointsMall_icon.png',
          showRightIcon: true,
          methodName: 'goPointsMallFn',
        },
        {
          label: '兑换中心',
          leftImg: '/static/myAccount/setting48_icon.png',
          showRightIcon: true,
          methodName: 'goLogisFn',
        },
        {
          label: '客服电话',
          leftImg: '/static/myAccount/service48_icon.png',
          showRightIcon: true,
          fields: ['phoneNum'],
          contentStyle: 'font-size: 24rpx;color: #808080;',
          methodName: 'makePhoneCallEvent'
        },
        // #ifdef MP-WEIXIN
        {
          label: '满意度调研',
          leftImg: '/static/myAccount/setting48_icon.png',
          showRightIcon: true,
          methodName: 'questionFn',
        },
        // #endif
        {
          label: '意见反馈',
          leftImgIconfont: 'icon-yijianfankui_tongyong_1',
          showRightIcon: true,
          methodName: 'feedbackListFn'
        },
        {
          label: '设置',
          leftImg: '/static/myAccount/setting48_icon.png',
          showRightIcon: true,
          methodName: 'setFn',
        }

      ],
      menuList: {
        phoneNum: '400-650-2828'
      },
      messageType: 'error',
      messageCount: 0,
      countCouponNum: 0, //优惠券数量
      modalOptions: { //绑定微信成功后弹框是否使用微信头像和昵称
        modalShow: false,
        custom: {
          titleIconShow: 'hide',
          title: '已成功绑定微信，是否使用微信昵称和头像用于个人信息展示',
          showCancelButton: true,
          showConfirmButton: true,
          confirmText: '展示微信昵称头像',
          cancelText: '返回',
          cancelOperation: 'backPurchaseOrder',
        }
      },
    }
  },
  mounted() {
    if (this.vuex_loginStatus) {
      this.noBrowseCountFn()
      this.getMemberInfoFn()
      this.countCouponNumForStautsFn()
      this.queryAccountBindWechatFn()
    }
    //#ifdef H5
    this.checkWeChatCode()//通过微信官方接口获取code之后，会重新刷新设置的回调地址【redirect_uri】
    // #endif
  },
  onLoad(option) {
  },

  methods: {

    goLogisFn() {
      const callbackUrl = `/pages/myAccount/index`
      if (!this.vuex_loginStatus) {
        // #ifdef MP-ALIPAY || MP-WEIXIN
        uni.navigateTo({
          url: `/login/login/codeLogin?type=my&callbackUrl=${callbackUrl}`
        })
        // #endif
        // #ifdef H5
        uni.redirectTo({
          url: `/login/login/mCodeLogin?callbackUrl=${callbackUrl}&typePage=h5`
        })
        // #endif
      } else {
        uni.navigateTo({
          url: '/myAccount/redemptionCode/index'
        })
      }
    },
    /*菜单列表执行函数*/
    handelCellMethod(methodName, val) {
      this[methodName](val)
    },
    /*查询账号是否绑定微信
    * params loginAccount: ---, mobilePhone: ---
    * data 1:已绑定，0:未绑定*/
    async queryAccountBindWechatFn() {
      const res = await queryAccountBindWechat()
      if (res.code != 0) {
        this.$u.toast(res.msg)
        return
      }
      this.isBindWechat = res.data
    },
    /*获取AuthCode方法*/
    getAuthCodeFn() {
      return new Promise((resolve, reject) => {
        const provider = this.vuex_provider
        getAuthCode(provider, (res) => {
          if (!res.code) {
            this.$u.toast('获取code失败')
            reject()
          }
          resolve(res.code)
        })
      })
    },
    /*获取微信用户信息方法*/
    getUserInfoFn() {
      return new Promise((resolve, reject) => {
        getUserInfo((userInfo) => {
          resolve(userInfo)
        }, '完善客户资料')
      })
    },
    /*账号绑定微信*/
    async accountBindWechatFn() {
      const userInfo = await this.getUserInfoFn()
      const authCode = await this.getAuthCodeFn()
      const {
        nickName,
        avatarUrl
      } = userInfo
      const params = {
        code: authCode,
      }
      // #ifdef MP-WEIXIN
      const accountInfoRes = await wxJsCode(params)
      if (accountInfoRes.errorCode == 0) {
        this.$u.toast('您的微信已绑定账号')
        return
      }
      if (accountInfoRes.errorCode != 2) {
        this.$u.toast(accountInfoRes.msg)
        return
      }
      const accountInfo = accountInfoRes.data
      const {
        openid,
        unionid
      } = accountInfo
      // #endif
      const bindWechatParams = {
        'nickname': nickName,
        'headimgurl': avatarUrl,
        'openid': openid,
        'unionid': unionid
      }
      const res = await accountBindWechat(bindWechatParams)
      if (res.code != 0) {
        this.$u.toast(res.msg)
        return
      }
      this.$u.toast('绑定成功')
      setTimeout(() => {
        getLoginInfoFn(this.vuex_accountInfo.memberId)
        this.queryAccountBindWechatFn()
      }, 1000)
      // this.modalOptions.modalShow = true // 由于微信官方更新，此功能暂时注掉
    },
    /*模态提示框确认*/
    async modalConfirmFn() {
      const userInfo = this.getUserInfoFn()
      const {
        nickName,
        avatarUrl
      } = userInfo
      const params = {
        'nikeName': nickName,
        'memberId': this.vuex_accountInfo.memberId,
        'headPicPathWechat': avatarUrl
      }
      const res = await modifyUserNikeName(params)
      if (res.code != 0) {
        this.$u.toast(res.msg)
        return
      }
      this.$u.toast('操作成功')
      getLoginInfoFn(this.vuex_accountInfo.memberId)
      this.modalOptions.modalShow = false
    },
    /*模态提示框返回*/
    modalCancelFn(res) {
      this.modalOptions.modalShow = false
    },
    /*获取可用优惠券数量*/
    async countCouponNumForStautsFn() {
      const params = {
        custId: this.vuex_memberInfo.memberId,
        useStatus: 20
      }
      const res = await countCouponNumForStauts(params)
      if (res.code != 0 && res.code != 1) {
        this.$u.toast(res.msg)
        return
      }
      this.countCouponNum = res.number
    },
    /*获取会员信息 vuex_memberLevelResp*/
    getMemberInfoFn() {
      getLoginInfoFn(this.vuex_memberInfo.memberId)
    },
    /*获取未读消息数量*/
    noBrowseCountFn() {
      const params = {
        memberId: this.vuex_memberInfo.memberId
      }
      noBrowseCount(params).then((res) => {
        if (Number(res.errorCode) == 0) {
          this.messageCount = res.data
        } else {
          this.$u.toast(res.message)
        }
      })
    },
    /*联系客服*/
    serviceFn() {
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      // #ifdef H5
      window.location.href = tdkUrl.develop + '/customer'
      // #endif
      // #ifdef MP-ALIPAY || MP-WEIXIN
      uni.navigateTo({ url: '/customer/index' })
      // #endif
    },
    /*消息列表*/
    messageFn() {
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      uni.navigateTo({ url: '/newNotice/newNotice' })
    },
    /*进入优惠券*/
    toCouponFn() {
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      uni.navigateTo({ url: '/myAccount/coupon/index' })
    },
    /*进入成长值记录列表*/
    toGrowthFn() {
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      uni.navigateTo({ url: '/myAccount/membershipInterests/growthValueRecords' })
    },
    /*设置*/
    setFn() {
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      uni.navigateTo({
        url: '/myAccount/setting/index'
      })
    },
    /* 意见反馈*/
    feedbackListFn() {
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      uni.navigateTo({
        url: '/customerFeedbackBox/customerFeedback/feedbackList'
      })
    },
    /*问卷*/
    // #ifdef MP-WEIXIN
    questionFn() {
      uni.navigateTo({
        url: '/myAccount/questionSurvey/index'
      })
    },
    // #endif
    /*进入我的收藏*/
    goCollectionFn() {
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      uni.navigateTo({
        url: '/myAccount/collection/index'
      })
    },
    /*进入常购商品*/
    goFrequentlyPurchasedGoodsFn() {
      console.log('常购')
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      uni.navigateTo({
        url: '/myAccount/frequentlyPurchasedGoods/index'
      })
    },
    /*进入礼品商城*/
    goPointsMallFn() {
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      uni.navigateTo({
        url: '/myAccount/pointsMall/index'
      })
    },
    /*进入会员权益*/
    goMemberFn() {
      if (!this.vuex_loginStatus) {
        this.onLoginButtonClick()
        return
      }
      uni.navigateTo({
        url: '/myAccount/membershipInterests/index'
      })
    },
    codeView(index) {
      var imgs = this.bindData.map((item) => item.qrCode)
      uni.previewImage({
        urls: imgs,
        current: index,
        // urls: imgsurl  // 需要预览的图片http链接列表
      });
    },
    showDialog() {
      this.getBindUser()
    },
    getBindUser() {
      const params = {
        loginAccount: this.vuex_accountInfo.loginAccount
      }
      getBindUser(params).then((res) => {
        if (res.errorCode == 1) {
          this.$u.toast('该登录账号地推人员邀请码为空')
          return
        }
        this.bindData = res.data
        this.show = true
      })
    },
    makePhoneCallEvent() {
      uni.makePhoneCall({
        phoneNumber: this.phoneNum,
        fail: (res) => {
          // this.$u.toast('已取消拨打')
        },
      })
    },
    quitEvent() {
      this.$u.vuex('vuex_allMemberInfos', {})
      this.$u.vuex('vuex_userInfo', {})
      this.$u.vuex('vuex_accountInfo', {})
      this.$u.vuex('vuex_loginStatus', false)
      this.$u.vuex('vuex_token', '')
      this.$u.vuex('vuex_memberInfo', {})
      this.$u.vuex('vuex_crmCustomerInfos', [])
      this.$u.vuex('vuex_memberCompanyInfo', {})
      this.$u.vuex('vuex_memberLevelResp', {})
      this.$u.vuex('vuex_cityInfo', {})
      uni.removeStorageSync('inviteCode');
    },
    avatarClickFn() {
      uni.navigateTo({
        url: `/myAccount/personalData/index`
      })
    },
    onLoginButtonClick() {
      if (!this.vuex_loginStatus) {
        const callbackUrl = `/pages/myAccount/index`
        // #ifdef MP-ALIPAY || MP-WEIXIN
        uni.navigateTo({
          url: `/login/login/codeLogin?type=my&callbackUrl=${callbackUrl}`
        })
        // #endif
        //#ifdef H5
        uni.navigateTo({
          url: `/login/login/mCodeLogin?type=my&callbackUrl=${callbackUrl}`
        })
        // #endif
      }

      // this.loginEvent(null, 'order');
    },
    //方法:用来提取code
    getUrlCode(name) {
      return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1]
        .replace(/\+/g, '%20')) || null
    },
    //检查浏览器地址栏中微信接口返回的code
    checkWeChatCode() {
      const code = this.getUrlCode('code')
      if (code) {
        const parame = {
          code: code,
          grant_type: 'authorization_code'
        }
        getWechatTokenByM(parame).then(res => {
          if (res.errorCode == 0) {
            const data = res.data
            this.getUserinfoByPcFn(data.access_token, data.openid, data.refresh_token)
          }
        }).catch((res) => {
          this.$u.toast(res.errmsg)
        })
      }
    },
    getUserinfoByPcFn(token, openid, refreshToken) {
      const parame = {
        access_token: token,
        openid: openid,
      }
      getUserinfoByPc(parame).then(res => {
        if (res.errorCode == 0) {
          this.$u.vuex('vuex_userInfo', res.data)
          this.wechatLoginV3Fn(res.data, refreshToken)
        }
      }).catch((res) => {
        this.$u.toast(res.errmsg)
      })
    },
    wechatLoginV3Fn(res, refreshToken) {
      const { nickname, openid, unionid, headimgurl } = res
      const parame = {
        platform: 'm',
        nickname: nickname,
        openid: openid,
        unionid: unionid,
        headimgurl: headimgurl,
        refreshToken: refreshToken

      }
      wechatLoginV3(parame).then(res => {
        if (res.code == 0) {
          this.$u.vuex('vuex_accountInfo', res.memberInfo)
          this.$u.vuex('vuex_userInfo', res.authWechatInfo)
          this.$u.vuex('vuex_loginStatus', true)
          // #ifdef H5
          this.$cookie.set('memberId', res.memberInfo.memberId, 365)
          this.$cookie.set('loginAccount', res.memberInfo.loginAccount, 365)
          this.$cookie.set('accountType', res.memberInfo.accountType, 365)
          this.$cookie.set('platformName', res.memberInfo.platformType, 365)
          this.$cookie.set('sourceUrl', encodeURIComponent(window.location.href), 1)
          this.$cookie.set('lgdomain', this.$cookie.getUrlDomain(), 365);
          this.$cookie.set('registerSource', res.memberInfo.registerSource, 365);
          const mySelectStation = JSON.parse(localStorage.getItem('my_select_station'));
          var lifeData = JSON.parse(localStorage.getItem('lifeData'));
          if (mySelectStation) {
            uni.$u.vuex('vuex_cityInfo', mySelectStation);
            uni.$u.vuex('vuex_nowAddress', { 'name': mySelectStation.cityName, 'cityCode': mySelectStation.cityCode, 'provinceCode': mySelectStation.provinceCode, 'provinceName': mySelectStation.provinceName, 'warehouseCode': mySelectStation.warehouseCode });
          } else {
            lifeData.data.vuex_nowAddress = {}
            lifeData.data.vuex_nowAddress.cityCode = '110100'
            lifeData.data.vuex_nowAddress.name = '北京市'
            lifeData.data.vuex_nowAddress.provinceCode = '110000'
            lifeData.data.vuex_nowAddress.provinceName = '北京市'
            lifeData.data.vuex_nowAddress.warehouseCode = '1'
            lifeData.data.vuex_cityInfo = {}
            lifeData.data.vuex_cityInfo.cityCode = '110100'
            lifeData.data.vuex_cityInfo.cityName = '北京市'
            lifeData.data.vuex_cityInfo.provinceCode = '110000'
            lifeData.data.vuex_cityInfo.provinceName = '北京市'
            lifeData.data.vuex_cityInfo.warehouseCode = '1'
            localStorage.setItem('lifeData', JSON.stringify(lifeData))
          }
          // #endif
          location.reload()
        } else {
          uni.redirectTo({ url: '/login/login/bindMobileNumber?weixinData=' + encodeURIComponent(JSON.stringify(parame)) })
        }
      }).catch((res) => {
        this.$u.toast(res.errmsg)
      })
    }
  }
}
</script>
<style scoped lang="scss">
.qrcodeImgs{
  width: 207rpx;
  height: 139rpx;
}
.topImg{
  width: 100%;
  display: flex;
  justify-content: center;
  color: #666666;
  font-size:$uni-font-size-sm;
  flex-direction: column;
  align-items: center;
  align-content: center;
  img{
    width: 168rpx;
    height: 244rpx;
    margin-bottom: 28rpx;
  }
}
.Qustion{
  font-size:$uni-font-size-sm;
  color: #666666;
  text-align: center;
  margin-top: 32rpx;
  text{
    color: #FF0C1B;
  }
}
.dialog{
  padding-bottom: 40rpx;
  box-sizing: border-box;
  .title-img{
    width: 200rpx;
    height: 46rpx;
    display: block;
    margin: 0 auto 14rpx;
  }
  .bodyCon{
    max-height: 50vh;
    overflow-y: auto;
  }
  .top_icons{
    .tips{
      color:$uni-text-color-grey;
      font-size:$uni-font-size-sm;
      padding:14rpx 104rpx;
    }
    .icons{
      display: flex;
      justify-content: flex-end;
      padding: 30rpx 30rpx 0 0;
      box-sizing: border-box;
    }
  }
  .content{
    font-size: $uni-font-size-base;
    text-align: center;
    margin: 0 auto;
    img{
      width:490rpx;
      height:490rpx;
    }
    .Conten_small{
      width:90%;
      margin: 0 auto;
      text-align: left;
      border-top: 1px solid $uni-border-gray;
      .name{
        font-size:$uni-font-size-lg;
        font-weight: bold;
      }
      .tel{
        font-size:$uni-font-size-base;
      }
    }
    p{
      padding: 16rpx;
    }
  }
}
.saleUser{
  width: 94%;
  height: 88rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  align-content: center;
  background: $uni-bg-color;
  font-size:$uni-font-size-base;
  margin: 0 auto;
  padding: 0rpx 18rpx 0rpx 36rpx;
  border-bottom: 2rpx solid #d9d9d9;
  box-sizing: border-box;
  color: #666666;
  margin-top: 28rpx;
}
.serviceview{
  height:75rpx;
  line-height: 75rpx;
  padding:0 24rpx;
  background-color:#FFF9ED;
  color:$uni-orange;
  //.notice{
  //  background: url("../../static/image/mine_notice.png") no-repeat 0 18rpx/36rpx 36rpx;
  //  padding: 0 0 0 52rpx;
  //  float: left;
  //  .number{
  //    color: #5584FF;
  //  }
  //}
  .time{
    float: right;
  }
}
.quitButton {
  width: 94%;
  height: 88rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  align-content: center;
  background: $uni-bg-color;
  font-size:$uni-font-size-base;
  padding: 0rpx 18rpx 0rpx 36rpx;
  margin: 0 auto;
  border-bottom: 2rpx solid #d9d9d9;
  box-sizing: border-box;
  color: #666666;
}
.userview {
  height: 260rpx;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: row;
  .userview-bg{
    width: 100%;
    height: 260rpx;
    position: absolute;
    top:0;
    left:0;
    z-index: -1;
  }
  .growth-weixin{
    width: 298rpx;
    height: 40rpx;
    margin: 112rpx 0 0 32rpx;
    background: #3D5656;
    border-radius: 20rpx;
    line-height: 40rpx;
    view{
      float: left;
      color: $uni-bg-color;
    }
    .growth-weixin-title{
      width: 198rpx;
      height: 40rpx;
      background: #68B984;
      border-radius: 20rpx;
      font-size: 20rpx;
      .growth-wechat-icon {
        font-size: $uni-font-size-lg;
        float: left;
        margin: 0 8rpx;
      }
    }
    .growth-weixin-val{
      margin-left: 8rpx;
      .growth-right-icon {
        margin-left: 8rpx;
        font-size:$uni-font-size-sm;
      }
    }
  }
}
.content-box{
  width:100%;
  position: absolute;
  .user-info {
    min-height: 120rpx;
    width: 100%;
    color: #000;
    background: transparent;
    position: relative;
    margin-top: 32rpx;
    margin-bottom: 16rpx;
    .usericon {
      background-color:$uni-bg-color;
      width:120rpx;
      height:120rpx;
      margin-left: 32rpx;
      border-radius: 50%;
      border:2rpx solid #FFF;
      float: left;
      box-shadow:0 0 8px 2px rgba(0,0,0,0.2);
      img{
        display: block;
        width:120rpx;
        height:120rpx;
        border-radius: 50%;
      }
    }
    .userinfo-wrap {
      display: flex;
      flex-direction: column;
      justify-content: center;
      padding: 0 32rpx 0 0;
      .userinfoview {
        margin: 16rpx 0 0 24rpx;
        float: left;
        font-size:$uni-font-size-lg;
      .logininfo {
        width: 100%;
        font-weight: bold;
        .tel {
          font-size: $uni-font-size-sm;
          margin-top: 14rpx;
          color: $uni-grey-999;
          font-weight: normal;
        }
        .user-name{
          max-width: 240rpx;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
      }
      .flex-info-wrap {
        display: flex;
        align-items: baseline;
        .company-name {
          flex: 1;
          margin-left: 8rpx;
          font-weight: normal;
          font-size:$uni-font-size-sm;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
      }
    }
    .vip-wrap {
      display: flex;
      justify-content: space-between;
      margin-left: 24rpx;
      .vip-info-img{
        font-size: $uni-font-size-sm;
        margin-top: 8rpx;
        color: $uni-grey-999;
        font-weight: normal;
      }
      .operate-box{
        position: relative;
        margin-right: 0;
        margin-top: 24rpx;
        .service-icon, .message-icon, .setting-icon {
          float: left;
          font-size: 48rpx;
          margin-left: 36rpx;
        }
        .box{
          position: absolute;
          top: -10rpx;
          left: 140rpx;
          font-size: 20rpx;
          border-radius: 15px;
          /deep/ .u-badge--error{
            background-color:$uni-orange!important;
          }
        }
      }
    }
  }
  .nologin-tips {
    font-size:$uni-font-size-base;
    margin-top: 14rpx;
    color: $uni-grey-999;
    font-weight: normal;
  }
  }
  .menu-cell-box{
    .el-combination{
      width: 750rpx;
      height: 152rpx;
      background: url("https://fsyuncai-file.oss-cn-beijing.aliyuncs.com/applet/el_combination_icon.png") no-repeat 0 0/750rpx 152rpx;
      ul{
        padding: 0 32rpx;
        list-style: none;
        li{
          width: calc(100% / 3);
          float: left;
          .li-item{
            width: calc(100% - 2rpx);
            text-align: center;
            color: $uni-bg-color;
            float: left;
            margin-top: 24rpx;
            .item-val{
              font-size: $uni-font-size-lg;
            }
            .item-title{
              opacity: 0.6;
              font-size: $uni-font-size-sm;
              padding-left: 24rpx;
              .normal-right-icon{
                font-size: $uni-font-size-sm;
              }
            }
          }
          .dash-line{
            width:0;
            border-left:2rpx dashed #888079;
            height: 80rpx;
            float: left;
            margin-top: 24rpx;
          }
        }
      }
    }
    .menu-cell{
      margin: -12rpx 32rpx 100rpx;
    }
  }
}
.NoData{
  width: 658rpx;
}
</style>
